/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidade;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Lomanda
 */
@Entity
@Table(name = "tbencomendastock")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EncomendaStock.findAll", query = "SELECT e FROM EncomendaStock e"),
    @NamedQuery(name = "EncomendaStock.findById", query = "SELECT e FROM EncomendaStock e WHERE e.id = :id"),
    @NamedQuery(name = "EncomendaStock.findByDataEncomenda", query = "SELECT e FROM EncomendaStock e WHERE e.dataEncomenda = :dataEncomenda"),
    @NamedQuery(name = "EncomendaStock.findByDataEntrega", query = "SELECT e FROM EncomendaStock e WHERE e.dataEntrega = :dataEntrega")})
public class EncomendaStock implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dataEncomenda")
    @Temporal(TemporalType.DATE)
    private Date dataEncomenda;
    @Column(name = "dataEntrega")
    @Temporal(TemporalType.DATE)
    private Date dataEntrega;
    @JoinColumn(name = "fkHistorico", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private HistoricoStock fkHistorico;
    @JoinColumn(name = "fkFornecedor", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private FornecedorStock fkFornecedor;

    public EncomendaStock() {
    }

    public EncomendaStock(Integer id) {
        this.id = id;
    }

    public EncomendaStock(Integer id, Date dataEncomenda) {
        this.id = id;
        this.dataEncomenda = dataEncomenda;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDataEncomenda() {
        return dataEncomenda;
    }

    public void setDataEncomenda(Date dataEncomenda) {
        this.dataEncomenda = dataEncomenda;
    }

    public Date getDataEntrega() {
        return dataEntrega;
    }

    public void setDataEntrega(Date dataEntrega) {
        this.dataEntrega = dataEntrega;
    }

    public HistoricoStock getFkHistorico() {
        return fkHistorico;
    }

    public void setFkHistorico(HistoricoStock fkHistorico) {
        this.fkHistorico = fkHistorico;
    }

    public FornecedorStock getFkFornecedor() {
        return fkFornecedor;
    }

    public void setFkFornecedor(FornecedorStock fkFornecedor) {
        this.fkFornecedor = fkFornecedor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EncomendaStock)) {
            return false;
        }
        EncomendaStock other = (EncomendaStock) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidade.EncomendaStock[ id=" + id + " ]";
    }
    
}
